package com.ruoyi.web.controller.construction;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.system.domain.construction.ConstructionPicInfo;
import com.ruoyi.system.domain.zhuangxiumain.shopMain.SupplierInfo;
import com.ruoyi.system.service.construction.WorkingSupplierService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 施工队店铺管理控制层
 */
@RestController
@RequestMapping("/construction/workingSupplier")
public class WorkingSupplierController extends BaseController {

    @Autowired
    private WorkingSupplierService workingSupplierService;

    @Autowired
    private TokenService tokenService;

    /**
     * 查询施工队图片信息列表
     */
    @PreAuthorize("@ss.hasPermi('construction:workingSupplier:list')")
    @GetMapping("/list")
    public TableDataInfo list(SupplierInfo supplierInfo)
    {
        startPage();
        // 获取登录用户ID
        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
        Long userId = loginUser.getUser().getUserId();
        List<SupplierInfo> list = workingSupplierService.selectSupplierInfoByWorkingList(supplierInfo,userId);
        return getDataTable(list);
    }

}

